<template>
	<div>
		<el-table :data="value.gridOperation.datalist">
		<el-table-column v-for="item in value.gridOperation.normalitems"
        :prop="item.prop"
        :label="item.label"
        :width="item.width">
      </el-table-column>
      <el-table-column label='操作'  v-if= "value.gridOperation.operationitem.length > 0" :width="value.gridOperation.operationitem.length * 80">
      	<template slot-scope="row">
           <el-button v-for="item in value.gridOperation.operationitem" type="text"  @click="itemclick(item.method,row)" >
            <i class="el-icon--right" :class="item.icon"></i>&nbsp;{{item.name}}
          </el-button>     		
      	</template>
      </el-table-column>
		</el-table>
    <el-row justify="end">
      <el-col style="text-align: right;">
        <el-pagination 
        :current-page="value.pageIndex" 
        :page-sizes="[10, 20, 50, 100]" 
        :page-size="value.pageSize" 
        :page-count="value.totalPage" 
        :total="value.total"
        @size-change="sizeChangeHandle"
        @current-change="currentChangeHandle"
        layout="total, sizes, prev, pager, next, jumper" />
      </el-col>
    </el-row>		
	</div>	
</template>
<script>
	export default{
		props: {
			value: {
				type: Object,
				default: {}
			}
		},
		methods: {
      // 每页数
      sizeChangeHandle(val) {
          this.value.pageSize = val
          this.value.pageIndex = 1
          this.$emit("searchmethod")
      },
      // 当前页
      currentChangeHandle(val) {
          this.value.pageIndex = val
          this.$emit("searchmethod")
          // this.getDataList()
      },			
			itemclick(method, row) {
        if(typeof(method) === 'function'){
          method(row.row)
        }        
        // this.$emit(method, row)
			}
		}
	}
</script>
